var mapIds = [993173050];
var 准备地图 = 993173150;

function init() {}

function setup(c, a) {
    em.setProperty("state", 1);
    em.setProperty("leader", "true");
    var c = em.newInstance("荣耀活动_海岸峭壁之战_阻截登陆");
    for (var b = 0; b < mapIds.length; b++) {
        var d = c.setInstanceMap(mapIds[b]);
        d.resetFully()
    }
    c.schedule("小船袭击", 1 * 60 * 1000);
    return c
}

function 小船袭击(a) {
    a.setProperty("ship", 1);
    a.getPlayers().forEach(function (b) {
        b.getAPI().gloryEnableEventSkill(240, 11, 3);
        b.getAPI().getWeatherEffectNotice("敌方登陆船出没！请点击NPC/采集快捷键，投掷收集的炮弹！", 297, 7000, 1);
        b.getAPI().fieldEffect_ScreenMsg("Effect/EliteMobEff.img/eliteMonster/0")
    });
    a.schedule("小船袭击结束", 1 * 60 * 1000);
    a.schedule("小船召唤", a.rand(1, 5) * 1000)
}

function 小船袭击结束(a) {
    a.setProperty("ship", 0);
    a.schedule("禁用炸弹", 15 * 1000);
    a.schedule("小船袭击", 3 * 60 * 1000)
}

function 禁用炸弹(a) {
    a.getPlayers().forEach(function (b) {
        b.getAPI().gloryEnableEventSkill(240, 11, 7);
        b.getAPI().getWeatherEffectNotice("登陆船已离开！为了摧毁敌方登陆船，必须先消灭炸弹兵，收集炸弹！", 297, 7000, 1)
    })
}

function 小船召唤(a) {
    if (a.getNumberProperty("ship") == 0) {
        return
    }
    a.getMapInstance(0).spawnMonsterOnGroundBelow(em.getMonster(9833654), new java.awt.Point(-787, 305));
    a.schedule("小船召唤", a.rand(1, 5) * 1000)
}

function onPlayerRegistered(b, a) {
    a.setReviveCount(-100);
    var c = b.getMapInstance(0);
    a.changeMap(c, c.getPortal(0))
}

function onPlayerRevived(b, a) {
    return false
}

function onMapChanged(c, b, a) {
    em.setProperty("kill", "0");
    em.setProperty("level", "0");
    em.setProperty("clear", "0");
    em.setProperty("curMap", a);
    if (mapIds.indexOf(a) < 0) {
        on玩家退场(c, b, false);
        return
    }
}

function onPlayerDisconnected(b, a) {
    on玩家退场(b, a, false);
    return 0
}

function onMonsterDamaged(b, a, d, e, c) {}

function onTimeOut(a) {
    a.getPlayers().forEach(function (b) {
        on玩家退场(a, b, true)
    })
}

function onMonsterKilled(b, e, c) {
    var a = em.getNumberProperty("kill") + 1;
    em.setProperty("kill", a);
    var d = player.getAPI().addNumberForQuestInfo(100342, "collectCount", 1);
    if (d == 40) {
        player.getAPI().setNumberForQuestInfo(100342, "collectCount", 0);
        player.getAPI().addNumberForQuestInfo(100342, "bomb", 1, 0, 9);
        player.getAPI().getTopMsgFont("获得了炮弹！", 4, 20, 20, 0, 0)
    }
}

function onPartyDisbanded(a) {}

function onPlayerKilled(b, a) {}
var setupTask;

function randomNum(b, a) {
    switch (arguments.length) {
        case 1:
            return parseInt(Math.random() * b + 1, 10);
            break;
        case 2:
            return parseInt(Math.random() * (a - b + 1) + b, 10);
            break;
        default:
            return 0;
            break
    }
}

function initProp(a, b) {
    if (em.getProperty(a) == null) {
        em.setProperty(a, b)
    }
}

function initPropArray(a, d, c, e) {
    for (var b = c; b <= e; b++) {
        if (em.getProperty(a + "_" + b) == null) {
            em.setProperty(a + "_" + b, d)
        }
    }
}

function on玩家退场(c, b, a) {
    b.getAPI().gloryMagicMudmanUI(0, 3, 0);
    b.getAPI().gloryMagicMudmanUI(0, 4, 0);
    c.disposeIfPlayerBelow(a ? 999 : 0, 准备地图);
    em.getProperties().clear();
    em.setProperty("state", 0);
    em.setProperty("leader", "true");
    c.unregisterPlayer(b)
}

function onItemPickedUp(b, a, c) {};